#!/usr/bin/python
# -*- coding: latin-1 -*-
import os, sys
import string
import getopt

# Ruta resolv.conf 
Path_PPPoE_Start_Tmp = '/etc/resolv.conf'

# Set Configuracion
def updateResolvConfig(dns1, dns2):
	try:
		outfile = open(Path_PPPoE_Start_Tmp, 'w') 
		outfile.write('# Archivo generado por el cliente Conexión3G'+ '\n')
		outfile.write('nameserver '+ dns1 + '\n')
		outfile.write('nameserver '+ dns2 + '\n')
		outfile.close()
	except Exception, msg:
		print msg

def main():
	print "Configure Dns Ejecutado"

if __name__ == "__main__":
	try:
		opts, args = getopt.getopt(sys.argv[1:],'')
	except getopt.error, msg:
		print msg
		print "Por ayuda use --help"
		sys.exit(2)
	# process arguments
	if (len(args) < 2):
		print "Debe especificar la configuración de los nameservers a configurar"
	else:
		updateResolvConfig(sys.argv[1], sys.argv[2])


